KERNELDIR := /home/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga_alientek  
CURRENT_PATH := $(shell pwd)  

MODULE_NAME := esp32_spi
# 目标：生成esp_wifi.ko
obj-m := $(MODULE_NAME).o

# 告诉make esp_wifi.o由哪些源文件生成
$(MODULE_NAME)-y := esp_wifi.o esp_spi.o esp_uart.o

build: kernel_modules  

kernel_modules:  
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules  

clean:  
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean